package com.xyh;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class BookApplication {
    @Autowired
    private Environment env;
    @RequestMapping(value = "gp")
    public String home(){

        for (String str:env.getActiveProfiles()) {
            System.out.println(str);
        }

        System.out.println("读取值"+env.getProperty("my-config.appName"));
        return "hello";
    }
    public static void main(String[] args){
        new SpringApplicationBuilder(BookApplication.class).web(true).run(args);
    }
}
